package com.bkgy.controller.shutdowndetails.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bkgy.controller.shutdowndetails.entity.*;
import com.bkgy.controller.shutdowndetails.entity.dto.TbDowntimeTcm2280Dto;
import com.bkgy.controller.shutdowndetails.mapper.ShutdownMapper;
import com.bkgy.controller.shutdowndetails.service.ShutdownService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShutdownServiceImpl implements ShutdownService {

    @Autowired
    private ShutdownMapper shutdownMapper;

    @Override
    public List<TbDowntimeTcm2280Dto> getTbDowntimeTcm2280List(String startDate, String endDate) {
        return shutdownMapper.getTbDowntimeTcm2280List(startDate, endDate);
    }

    @Override
    public List<TbDowntimeTcm2280Dto> selectTcmDownTimeMonth(String startDate) {
        return shutdownMapper.selectDownTimeMonth(startDate);
    }

    @Override
    public List<tbDowntimeCal1630> selectCal1630DownTimeMonth(String startDate) {
        return shutdownMapper.selectCal1630DownTimeMonth(startDate);
    }

    @Override
    public List<tbDowntimeCal2150> selectCal2150DownTimeMonth(String startDate) {
        return shutdownMapper.selectCal2150DownTimeMonth(startDate);
    }

    @Override
    public List<tbDowntimeCgl1870> selectcglDownTimeMonth(String startDate) {
        return shutdownMapper.selectcglDownTimeMonth(startDate);
    }

    /**
     * 1630连退停机记录-分页
     * @param request_get tbDowntimeCal1630
     * @return ResultData
     */
    public ResultData getTbDowntimeCal1630_page(tbDowntimeCal1630 request_get) {
        tbDowntimeCal1630 request =  setdatetime(request_get);
        try {
            Page<?> page = new Page<>(request.getPageIndex(), request.getPageSize());
            List<tbDowntimeCal1630> list = shutdownMapper.getTbDowntimeCal1630_page(page,request);
            Integer count = (int)page.getTotal();
            return ResultData.ResultDataSuccess(list, count);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 2150连退停机记录-分页
     * @param request_get tbDowntimeCal2150
     * @return ResultData
     */
    public ResultData getTbDowntimeCal2150_page(tbDowntimeCal2150 request_get) {
        tbDowntimeCal2150 request =  setdatetime(request_get);
        try {
            Page<?> page = new Page<>(request.getPageIndex(), request.getPageSize());
            List<tbDowntimeCal2150> list = shutdownMapper.getTbDowntimeCal2150_page(page,request);
            Integer count = (int)page.getTotal();
            return ResultData.ResultDataSuccess(list, count);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 1870镀锌停机记录
     * @param request_get tbDowntimeCgl1870
     * @return ResultData
     */
    public ResultData getTbDowntimeCgl1870_page(tbDowntimeCgl1870 request_get) {
        tbDowntimeCgl1870 request =  setdatetime(request_get);
        try {
            Page<?> page = new Page<>(request.getPageIndex(), request.getPageSize());
            List<tbDowntimeCgl1870> list = shutdownMapper.getTbDowntimeCgl1870_page(page,request);
            Integer count = (int)page.getTotal();
            return ResultData.ResultDataSuccess(list, count);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 2280酸轧停机记录
     * @param request_get tbDowntimeTcm2280
     * @return ResultData
     */
    public ResultData getTbDowntimeTcm2280_page(TbDowntimeTcm2280Dto request_get) {
        TbDowntimeTcm2280Dto request =  setdatetime(request_get);
        try {
            Page<?> page = new Page<>(request.getPageIndex(), request.getPageSize());
            List<TbDowntimeTcm2280Dto> list = shutdownMapper.getTbDowntimeTcm2280_page(page,request);
            Integer count = (int)page.getTotal();
            return ResultData.ResultDataSuccess(list, count);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 1630连退停机记录-客户录入功能
     * @param request tbDowntimeCal1630
     */
    public ResultData updateTbDowntimeCal1630(tbDowntimeCal1630 request) {
        try {
            Integer row = shutdownMapper.updateTbDowntimeCal1630(request);
            return ResultData.ResultDataSuccessSelf("修改成功", null);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("修改失败,失败信息为" + e.getMessage(), null);
        }
    }

    /**
     * 2150连退停机记录-客户录入功能
     * @param request tbDowntimeCal2150
     */
    public ResultData updateTbDowntimeCal2150(tbDowntimeCal2150 request) {
        try {
            Integer row = shutdownMapper.updateTbDowntimeCal2150(request);
            return ResultData.ResultDataSuccessSelf("修改成功", null);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("修改失败,失败信息为" + e.getMessage(), null);
        }
    }

    /**
     * 1870镀锌停机记录-客户录入功能
     * @param request tbDowntimeCgl1870
     */
    public ResultData updateTbDowntimeCgl1870(tbDowntimeCgl1870 request){
        try {
            Integer row = shutdownMapper.updateTbDowntimeCgl1870(request);
            return ResultData.ResultDataSuccessSelf("修改成功", null);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("修改失败,失败信息为" + e.getMessage(), null);
        }
    }

    /**
     * 2280酸轧停机记录-客户录入功能
     * @param request tbDowntimeTcm2280
     */
    public ResultData updateTbDowntimeTcm2280(TbDowntimeTcm2280Dto request){
        try {
            Integer row = shutdownMapper.updateTbDowntimeTcm2280(request);
            return ResultData.ResultDataSuccessSelf("修改成功", null);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("修改失败,失败信息为" + e.getMessage(), null);
        }
    }

    /**
     * 根据前台传入查询开始和查询结束日期，构造出三种时间格式以便后续表数据查询
     * @param request tbDowntimeCal2150
     * @return tbDowntimeCal2150
     */
    public tbDowntimeCal2150 setdatetime(tbDowntimeCal2150 request) {
        tbDowntimeCal2150 request_get = request;
        try {
            String[] array_startTime = request.getDbegin().split("-");//时间格式：2025-06-01 00:00:01
            String startTime = "";//时间格式：2025-06-28-17.09.46.000000
            if (array_startTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000
                String times2 = array_startTime[2].replace(" ", "-");
                times2 = times2.replace(":", ".");
                times2=times2+".000000";
                startTime = array_startTime[0] + "-" + array_startTime[1] + "-" + times2;
            }
            request_get.setDbegin(startTime);

        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String[] array_endTime = request.getDend().split("-");//时间格式：2025-06-01 00:00:01
            String endTime = "";////时间格式：2025-06-28-17.09.46.000000
            if (array_endTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000

                String times2=array_endTime[2].replace(" ","-");
                times2 = times2.replace(":",".");
                times2=times2+".000000";
                endTime=array_endTime[0]+ "-" + array_endTime[1]+ "-" + times2;
            }
            request_get.setDend(endTime);
        } catch (Exception e) {
            e.printStackTrace();
        }


        return request_get;
    }

    /**
     * 根据前台传入查询开始和查询结束日期，构造出三种时间格式以便后续表数据查询
     * @param request tbDowntimeTcm2280
     * @return tbDowntimeTcm2280
     */
    public TbDowntimeTcm2280Dto setdatetime(TbDowntimeTcm2280Dto request) {
        TbDowntimeTcm2280Dto request_get = request;
        try {
            String[] array_startTime = request.getDbegin().split("-");//时间格式：2025-06-01 00:00:01
            String startTime = "";//时间格式：2025-06-28-17.09.46.000000
            //array_startTime.length > 0时，dbegin参数为空串时会报错
            if (array_startTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000
                String times2 = array_startTime[2].replace(" ", "-");
                times2 = times2.replace(":", ".");
                times2=times2+".000000";
                startTime = array_startTime[0] + "-" + array_startTime[1] + "-" + times2;
            }
            request_get.setDbegin(startTime);

        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String[] array_endTime = request.getDend().split("-");//时间格式：2025-06-01 00:00:01
            String endTime = "";////时间格式：2025-06-28-17.09.46.000000
            if (array_endTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000

                String times2=array_endTime[2].replace(" ","-");
                times2 = times2.replace(":",".");
                times2=times2+".000000";
                endTime=array_endTime[0]+ "-" + array_endTime[1]+ "-" + times2;
            }
            request_get.setDend(endTime);
        } catch (Exception e) {
            e.printStackTrace();
        }


        return request_get;
    }

    /**
     * 根据前台传入查询开始和查询结束日期，构造出三种时间格式以便后续表数据查询
     * @param request tbDowntimeCal1630
     * @return tbDowntimeCal1630
     */
    public tbDowntimeCal1630 setdatetime(tbDowntimeCal1630 request) {
        tbDowntimeCal1630 request_get = request;
        try {
            String[] array_startTime = request.getDbegin().split("-");//时间格式：2025-06-01 00:00:01
            String startTime = "";//时间格式：2025-06-28-17.09.46.000000
            if (array_startTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000
                String times2 = array_startTime[2].replace(" ", "-");
                times2 = times2.replace(":", ".");
                times2=times2+".000000";
                startTime = array_startTime[0] + "-" + array_startTime[1] + "-" + times2;
            }
            request_get.setDbegin(startTime);

        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String[] array_endTime = request.getDend().split("-");//时间格式：2025-06-01 00:00:01
            String endTime = "";////时间格式：2025-06-28-17.09.46.000000
            if (array_endTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000

                String times2=array_endTime[2].replace(" ","-");
                times2 = times2.replace(":",".");
                times2=times2+".000000";
                endTime=array_endTime[0]+ "-" + array_endTime[1]+ "-" + times2;
            }
            request_get.setDend(endTime);
        } catch (Exception e) {
            e.printStackTrace();
        }


        return request_get;
    }

    /**
     * 根据前台传入查询开始和查询结束日期，构造出三种时间格式以便后续表数据查询
     * @param request tbDowntimeCgl1870
     * @return tbDowntimeCgl1870
     */
    public tbDowntimeCgl1870 setdatetime(tbDowntimeCgl1870 request) {
        tbDowntimeCgl1870 request_get = request;
        try {
            String[] array_startTime = request.getDbegin().split("-");//时间格式：2025-06-01 00:00:01
            String startTime = "";//时间格式：2025-06-28-17.09.46.000000
            if (array_startTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000
                String times2 = array_startTime[2].replace(" ", "-");
                times2 = times2.replace(":", ".");
                times2=times2+".000000";
                startTime = array_startTime[0] + "-" + array_startTime[1] + "-" + times2;
            }
            request_get.setDbegin(startTime);

        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String[] array_endTime = request.getDend().split("-");//时间格式：2025-06-01 00:00:01
            String endTime = "";////时间格式：2025-06-28-17.09.46.000000
            if (array_endTime.length > 1) {

                //时间格式：2025-06-28-17.09.46.000000

                String times2=array_endTime[2].replace(" ","-");
                times2 = times2.replace(":",".");
                times2=times2+".000000";
                endTime=array_endTime[0]+ "-" + array_endTime[1]+ "-" + times2;
            }
            request_get.setDend(endTime);
        } catch (Exception e) {
            e.printStackTrace();
        }


        return request_get;
    }

    /**
     * 根据前台传入查询开始和查询结束日期，构造出三种时间格式以便后续表数据查询
     * @param request tbDowntimePlan
     * @return tbDowntimePlan
     */
    public tbDowntimePlan setdatetime(tbDowntimePlan request) {
        tbDowntimePlan request_get = request;
        try {
            String[] array_startTime = request.getDbegin().split("-");//时间格式：2025-06-01 00:00:01
            String startTime = "";//时间格式：2025-06-28-17.09.46.000000
            if (array_startTime.length > 1) {
                //时间格式：2025-06-28-17.09.46.000000
                String times2 = array_startTime[2].replace(" ", "-");
                times2 = times2.replace(":", ".");
                times2=times2+".000001";
                startTime = array_startTime[0] + "-" + array_startTime[1] + "-" + times2;
            }
            request_get.setDbegin(startTime);

        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            String[] array_endTime = request.getDend().split("-");//时间格式：2025-06-01 00:00:01
            String endTime = "";//时间格式：2025-06-28-17.09.46.000000
            if (array_endTime.length > 1) {
                //时间格式：2025-06-28-17.09.46.000000
                String times2=array_endTime[2].replace(" ","-");
                times2 = times2.replace(":",".");
                times2=times2+".999999";
                endTime=array_endTime[0]+ "-" + array_endTime[1]+ "-" + times2;
            }
            request_get.setDend(endTime);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return request_get;
    }


    /**
     * 根据前台传入查询年，构造YYYY格式
     * @param request tbDowntime
     * @return tbDowntime
     */
    public tbDowntime setdatetime(tbDowntime request) {
        tbDowntime request_get = request;
        try {
            if(!request_get.getYear().isEmpty())
            {
                if(request_get.getYear().length()!=4)
                {
                    //说明不是YYYY格式
                    String[] array_startTime = request.getYear().split("-");//时间格式：2025-06-01 00:00:01
                    String startYear = "";//时间格式：2025
                    if (array_startTime.length > 0) {
                        startYear = array_startTime[0] ;
                        request_get.setYear(startYear);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return request_get;
    }


    /**
     * 根据前台传入查询年，构造YYYY格式
     * @param request tbDownCrew
     * @return tbDownCrew
     */
    public tbDownCrew setdatetime(tbDownCrew request) {
        tbDownCrew request_get = request;
        try {
            if(!request_get.getYear().isEmpty())
            {
                if(request_get.getYear().length()!=4)
                {
                    //说明不是YYYY格式
                    String[] array_startTime = request.getYear().split("-");//时间格式：2025-06-01 00:00:01
                    String startYear = "";//时间格式：2025
                    if (array_startTime.length > 0) {
                        startYear = array_startTime[0] ;
                        request_get.setYear(startYear);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return request_get;
    }


    /**
     * 根据前台传入查询年，构造YYYY格式
     * @param request tbDownRate
     * @return tbDownRate
     */
    public tbDownRate setdatetime(tbDownRate request) {
        tbDownRate request_get = request;
        try {
            if(!request_get.getYear().isEmpty())
            {
                if(request_get.getYear().length()!=4)
                {
                    //说明不是YYYY格式
                    String[] array_startTime = request.getYear().split("-");//时间格式：2025-06-01 00:00:01
                    String startYear = "";//时间格式：2025
                    if (array_startTime.length > 0) {
                        startYear = array_startTime[0] ;
                        request_get.setYear(startYear);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return request_get;
    }

    /**
     * 近12个月轧机停机-各类停机原因- TCM2280
     * @param request_get tbDowntime
     * @return  List<tbDowntime>
     */
    public ResultData tbDowntimeTcm2280_stops(tbDowntime request_get) {
        tbDowntime request = setdatetime(request_get);
        try {
            List<tbDowntime> list = shutdownMapper.tbDowntimeTcm2280_stops(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 近12个月轧机停机-各类停机原因- CGL1870
     * @param request_get tbDowntime
     * @return  List<tbDowntime>
     */
    public ResultData tbDowntimeCgl1870_stops(tbDowntime request_get) {
        tbDowntime request = setdatetime(request_get);
        try {
            List<tbDowntime> list = shutdownMapper.tbDowntimeCgl1870_stops(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }


    /**
     * 近12个月轧机停机-各类停机原因- CAL1630
     * @param request_get tbDowntime
     * @return  List<tbDowntime>
     */
    public ResultData tbDowntimeCal1630_stops(tbDowntime request_get) {
        tbDowntime request = setdatetime(request_get);
        try {
            List<tbDowntime> list = shutdownMapper.tbDowntimeCal1630_stops(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }


    /**
     * 近12个月轧机停机-各类停机原因- CAL2150
     * @param request_get tbDowntime
     * @return  List<tbDowntime>
     */
    public ResultData tbDowntimeCal2150_stops(tbDowntime request_get) {
        tbDowntime request = setdatetime(request_get);
        try {
            List<tbDowntime> list = shutdownMapper.tbDowntimeCal2150_stops(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }


    /**
     * 近12月各班组轧机停机次数-CAL2150
     * @param request_get tbDownCrew
     * @return  List<tbDownCrew>
     */
    public ResultData tbDowntimeCal2150_crew(tbDownCrew request_get) {
        tbDownCrew request = setdatetime(request_get);
        try {
            List<tbDownCrew> list = shutdownMapper.tbDowntimeCal2150_crew(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 近12月各班组轧机停机次数-CAL1630
     * @param request_get tbDownCrew
     * @return  List<tbDownCrew>
     */
    public ResultData tbDowntimeCal1630_crew(tbDownCrew request_get) {
        tbDownCrew request = setdatetime(request_get);
        try {
            List<tbDownCrew> list = shutdownMapper.tbDowntimeCal1630_crew(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 近12月各班组轧机停机次数-CGL1870
     * @param request_get tbDownCrew
     * @return  List<tbDownCrew>
     */
    public ResultData tbDowntimeCgl1870_crew(tbDownCrew request_get) {
        tbDownCrew request = setdatetime(request_get);
        try {
            List<tbDownCrew> list = shutdownMapper.tbDowntimeCgl1870_crew(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 近12月各班组轧机停机次数-TCM2280
     * @param request_get tbDownCrew
     * @return  List<tbDownCrew>
     */
    public ResultData tbDowntimeTcm2280_crew(tbDownCrew request_get) {
        tbDownCrew request = setdatetime(request_get);
        try {
            List<tbDownCrew> list = shutdownMapper.tbDowntimeTcm2280_crew(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }


    /**
     * 近12月标准/日历作业率-CAL2150
     * @param request_get tbDownRate
     * @return  List<tbDownRate>
     */
    public ResultData tbDowntimeCal2150_rate(tbDownRate request_get) {
        tbDownRate request = setdatetime(request_get);
        try {
            List<tbDownRate> list = shutdownMapper.tbDowntimeCal2150_rate(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 近12月标准/日历作业率-CAL1630
     * @param request_get tbDownRate
     * @return  List<tbDownRate>
     */
    public ResultData tbDowntimeCal1630_rate(tbDownRate request_get) {
        tbDownRate request = setdatetime(request_get);
        try {
            List<tbDownRate> list = shutdownMapper.tbDowntimeCal1630_rate(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 近12月标准/日历作业率-CGL1870
     * @param request_get tbDownRate
     * @return  List<tbDownRate>
     */
    public ResultData tbDowntimeCgl1870_rate(tbDownRate request_get) {
        tbDownRate request = setdatetime(request_get);
        try {
            List<tbDownRate> list = shutdownMapper.tbDowntimeCgl1870_rate(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

    /**
     * 近12月标准/日历作业率-TCM2280
     * @param request_get tbDownRate
     * @return  List<tbDownRate>
     */
    public ResultData tbDowntimeTcm2280_rate(tbDownRate request_get) {
        tbDownRate request = setdatetime(request_get);
        try {
            List<tbDownRate> list = shutdownMapper.tbDowntimeTcm2280_rate(request);
            return ResultData.ResultDataSuccess(list);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }



    /**
     * 停机记录计划表-增
     * @param request tbDowntimePlan
     */
    public ResultData tbDowntimePlan_add(tbDowntimePlan request) {
        try {
            Integer row = shutdownMapper.tbDowntimePlan_add(request);
            return ResultData.ResultDataSuccessSelf("停机记录计划表 增加 成功", null);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("停机记录计划表 增加失败,失败信息为" + e.getMessage(), null);
        }
    }

    /**
     * 停机记录计划表-删
     * @param request tbDowntimePlan
     */
    public ResultData tbDowntimePlan_del(tbDowntimePlan request) {
        try {
            Integer row = shutdownMapper.tbDowntimePlan_del(request);
            return ResultData.ResultDataSuccessSelf("停机记录计划表 删除 成功", null);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("停机记录计划表 删除失败,失败信息为" + e.getMessage(), null);
        }
    }

    /**
     * 停机记录计划表-改
     * @param request tbDowntimePlan
     */
    public ResultData tbDowntimePlan_update(tbDowntimePlan request) {
        try {
            Integer row = shutdownMapper.tbDowntimePlan_update(request);
            return ResultData.ResultDataSuccessSelf("停机记录计划表 修改 成功", null);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("停机记录计划表 修改失败,失败信息为" + e.getMessage(), null);
        }
    }

    /**
     * 停机记录计划表-查
     * @param request_get tbDowntimePlan
     */
    public ResultData tbDowntimePlan_query(tbDowntimePlan request_get) {
        tbDowntimePlan request =  setdatetime(request_get);
        try {
            Page<?> page = new Page<>(request.getPageIndex(), request.getPageSize());
            List<tbDowntimePlan> list = shutdownMapper.tbDowntimePlan_query(page,request);
            Integer count = shutdownMapper.tbDowntimePlan_query_pagecount(request);
            return ResultData.ResultDataSuccess(list, count);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("获取失败" + e.getMessage(), null);
        }
    }

}
